﻿namespace Events
{
    // delegate type
    public delegate void MyDelegateType2(int a, int b);
    
    public class Publisher2
    {
        // private delegate
        private MyDelegateType2 myDelegate;

        // step 1:create event
        public event MyDelegateType2 myEvent;

        public void RaiseEvent(int a, int b)
        {
            // step 2:raise event
            if (this.myEvent != null)
            {
                this.myEvent(a, b);
            }
        }
    }
}